// src/main/java/com/example/player/Main.java
package com.example;


import com.example.command.PauseCommand;
import com.example.command.PlayCommand;
import com.example.command.SeekCommand;
import com.example.command.StopCommand;
import com.example.control.ControlPanel;
import com.example.core.MediaPlayer;


/**
 * 客户端类 (组装和执行)
 */
public class Main {
    public static void main(String[] args) {
        // 初始化播放器内核
        MediaPlayer mediaPlayer = new MediaPlayer();

        // 初始化控制面板
        ControlPanel controlPanel = new ControlPanel();

        // 绑定命令到控制面板
        controlPanel.setPlayCommand(new PlayCommand(mediaPlayer));
        controlPanel.setStopCommand(new StopCommand(mediaPlayer));
        controlPanel.setPauseCommand(new PauseCommand(mediaPlayer));
        controlPanel.setSeekCommand(new SeekCommand(mediaPlayer, 30));

        // 模拟用户操作
        controlPanel.clickPlay();    // 播放
        controlPanel.clickSeek();    // 跳转
        controlPanel.clickPause();  // 暂停
        controlPanel.clickStop();   // 停止
    }
}
